package com.ccc.model;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Order entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "orders")
public class Order  {


	private Integer orderId;
	private Integer fromUserId;
	private Integer toUserId;
	private Integer orderTime;
	private Integer orderTotalPrice;
	private List<Orderinfo> orderinfoes = new ArrayList<Orderinfo>();
	
	@OneToMany(cascade=CascadeType.ALL,mappedBy="order",fetch=FetchType.LAZY)
	public List<Orderinfo> getOrderinfoes() {
		return orderinfoes;
	}

	public void setOrderinfoes(List<Orderinfo> orderinfoes) {
		this.orderinfoes = orderinfoes;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "orderId", unique = true, nullable = false)
	public Integer getOrderId() {
		return this.orderId;
	}

	public void setOrderId(Integer orderId) {
		this.orderId = orderId;
	}

	@Column(name = "fromUserId", nullable = false)
	public Integer getFromUserId() {
		return this.fromUserId;
	}

	public void setFromUserId(Integer fromUserId) {
		this.fromUserId = fromUserId;
	}

	@Column(name = "toUserId", nullable = false)
	public Integer getToUserId() {
		return this.toUserId;
	}

	public void setToUserId(Integer toUserId) {
		this.toUserId = toUserId;
	}

	@Column(name = "orderTime", nullable = false)
	public Integer getOrderTime() {
		return this.orderTime;
	}

	public void setOrderTime(Integer orderTime) {
		this.orderTime = orderTime;
	}

	@Column(name = "orderTotalPrice")
	public Integer getOrderTotalPrice() {
		return this.orderTotalPrice;
	}

	public void setOrderTotalPrice(Integer orderTotalPrice) {
		this.orderTotalPrice = orderTotalPrice;
	}

}